<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
     <meta name='viewport' content='width=device-width, initial-scale=1.0'>
     <title>第一周试题</title>
     <link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/default.min.css'>
     <script src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js'></script>
</head>
<body>
     <pre class="language-javascript">
        <code class="language-javascript" style="width: 80%; margin: 0 auto; height: auto;">
            // 阿里面试题
            let a = {
                n:1
            }
            let b = a       // b ==> {n:1}  
            a.x = a = {
                n:2
            }

            // a ==> { n:2 x: { n:2 } }
            // b => { { n:2 x: { n:2 } } }
            // a ==> {n:2 }
            console.log(a.x); // undefined 
            console.log(b);  // { { n:2 x: { n:2 } } }
            //  腾讯面试题
            var aa = 'abc' + 123 + 456 // abc123456
            var bb = '456' - '123' // 456 - 123 = 333
            var cc = 100 + true + 21.2 + null + undefined + "Tencent" + [] + null + 9 + false
            // 101 + 21.2 + 0 + un   NaNTencentnull9false
            console.log(60 + undefined); // NaN 数值加上一个undefined为NaN
            console.log(60 + NaN); // NaN
            console.log(60 + null);//60 null是0
            console.log(aa,bb,cc);
            //  腾讯面试题
            console.log('typeof NaN',typeof NaN);
            var str = 'abc123'
            var num = parseInt(str) // NaN
            console.log(num);
            if(num == NaN){
                alert(NaN)
            }else if (num == 123) {
                console.log(123);
            }else if (typeof num == 'number'){ // typeof NaN == 'number'
                console.log('腾讯第二题number');
            }else {
                alert('str')
            }

            // 腾讯面试题
            var aaa = 0      // aaa == >  0
            var bbb = aaa    // bbb == >  0
            bbb++   // bbb ==> 1
            console.log(aaa) // aaa ==> 0
            var o = {}
            o.aaa = 0   // ooo { aaa:0 }
            var bbb = o  // bbb ==>  { aaa : 0 }
            bbb.aaa = 10 // ooo { aaa : 10 }
            console.log(o.aaa); // 10

            // 能输出‘1’的有哪些 ？？？ A == 》 其余全部是 数值类型1 只有alert是转化为字符串的1
            alert('1') // A ==> 1
            console.log(parseInt(1.3)) // b ==> 1
            console.log(1); // c ==> 1
            console.log(isNaN(1)); // d: ==> false
            console.log(parseInt("1")); // e ==> 1 


            // 下面输出的结果是"undefined"的是
            console.log(alert(1)); // 打印一个没有返回值的 只能是undefined 并且是非字符串类型的
            console.log('typeof',(typeof undefined ) == 'undefined');
            console.log('parseInt(undefined)',parseInt(undefined));
            console.log('isNaN(undefined)',isNaN(undefined));

            // 下面能得到true的结果的是
            console.log('null',isNaN(null)); // false
            console.log(isNaN(parseInt(null))); // true
            console.log(Number(null)); // 0
            console.log(parseFloat(null)); // NaN
            console.log(isNaN(null),isNaN(undefined),isNaN(NaN)); // false、true、true


            // 下面输出的值
            console.log("parseInt",parseInt("")); // NaN
            console.log("Number('')",Number("")); // 0
            console.log("isNaN('')",isNaN("")); // false
            console.log("parseInt(null)",parseInt(null)); // NaN
            console.log("Number(null)",Number(null)); // 0
            console.log("isNaN(nul)",isNaN(null)); // false
            console.log("parseInt(12px)",parseInt("12px")); // 12
            console.log("Number(12px)",Number("12px")); // NaN
            console.log("isNaN(12px)",isNaN('12px')); // true


            // 下面程序输出结果 ==> 输出‘好的’
            if (isNaN(NaN) == "") {
                console.log('你好');
            }else {
                console.log('好的');
            }

            // 下列程序输出结果
            let x = [1,2,3] // x ==> [1.2.3]
            let y = x // y ==> [1.2.3]
            let z = [4,5,6] // z ==> [4.5.6]
            y[0] = 10 //  x == y == [10.2.3]
            y = z // x ==> [10.2.3]    y == z == [4.5.6]
            z[1] = 20 // x ==> [10.2.3]    y == z == [4.20.6]
            x[2] = z = 30 // x ==> [10.2.30]    y == [\z\] == [4.20.6]  z == 30
            console.log('x',x,'y',y,'z',z); // [10.2.30] [4.20.6] 30
        </code>
     </pre>
     <script> hljs.highlightAll(); </script>
     <script>
            // 阿里面试题
            let a = {
                n:1
            }
            let b = a       // b ==> {n:1}  
            a.x = a = {
                n:2
            }

            // a ==> { n:2 x: { n:2 } }
            // b => { { n:2 x: { n:2 } } }
            // a ==> {n:2 }
            console.log(a.x); // undefined 
            console.log(b);  // { { n:2 x: { n:2 } } }
            //  腾讯面试题
            var aa = 'abc' + 123 + 456 // abc123456
            var bb = '456' - '123' // 456 - 123 = 333
            var cc = 100 + true + 21.2 + null + undefined + "Tencent" + [] + null + 9 + false
            // 101 + 21.2 + 0 + un   NaNTencentnull9false
            console.log(60 + undefined); // NaN 数值加上一个undefined为NaN
            console.log(60 + NaN); // NaN
            console.log(60 + null);//60 null是0
            console.log(aa,bb,cc);
            //  腾讯面试题
            console.log('typeof NaN',typeof NaN);
            var str = 'abc123'
            var num = parseInt(str) // NaN
            console.log(num);
            if(num == NaN){
                alert(NaN)
            }else if (num == 123) {
                console.log(123);
            }else if (typeof num == 'number'){ // typeof NaN == 'number'
                console.log('腾讯第二题number');
            }else {
                alert('str')
            }

            // 腾讯面试题
            var aaa = 0      // aaa == >  0
            var bbb = aaa    // bbb == >  0
            bbb++   // bbb ==> 1
            console.log(aaa) // aaa ==> 0
            var o = {}
            o.aaa = 0   // ooo { aaa:0 }
            var bbb = o  // bbb ==>  { aaa : 0 }
            bbb.aaa = 10 // ooo { aaa : 10 }
            console.log(o.aaa); // 10

            // 能输出‘1’的有哪些 ？？？ A == 》 其余全部是 数值类型1 只有alert是转化为字符串的1
            alert('1') // A ==> 1
            console.log(parseInt(1.3)) // b ==> 1
            console.log(1); // c ==> 1
            console.log(isNaN(1)); // d: ==> false
            console.log(parseInt("1")); // e ==> 1 


            // 下面输出的结果是"undefined"的是
            console.log(alert(1)); // 打印一个没有返回值的 只能是undefined 并且是非字符串类型的
            console.log('typeof',(typeof undefined ) == 'undefined');
            console.log('parseInt(undefined)',parseInt(undefined));
            console.log('isNaN(undefined)',isNaN(undefined));

            // 下面能得到true的结果的是
            console.log('null',isNaN(null)); // false
            console.log(isNaN(parseInt(null))); // true
            console.log(Number(null)); // 0
            console.log(parseFloat(null)); // NaN
            console.log(isNaN(null),isNaN(undefined),isNaN(NaN)); // false、true、true


            // 下面输出的值
            console.log("parseInt",parseInt("")); // NaN
            console.log("Number('')",Number("")); // 0
            console.log("isNaN('')",isNaN("")); // false
            console.log("parseInt(null)",parseInt(null)); // NaN
            console.log("Number(null)",Number(null)); // 0
            console.log("isNaN(nul)",isNaN(null)); // false
            console.log("parseInt(12px)",parseInt("12px")); // 12
            console.log("Number(12px)",Number("12px")); // NaN
            console.log("isNaN(12px)",isNaN('12px')); // true


            // 下面程序输出结果 ==> 输出‘好的’
            if (isNaN(NaN) == "") {
                console.log('你好');
            }else {
                console.log('好的');
            }

            // 下列程序输出结果
            let x = [1,2,3] // x ==> [1.2.3]
            let y = x // y ==> [1.2.3]
            let z = [4,5,6] // z ==> [4.5.6]
            y[0] = 10 //  x == y == [10.2.3]
            y = z // x ==> [10.2.3]    y == z == [4.5.6]
            z[1] = 20 // x ==> [10.2.3]    y == z == [4.20.6]
            x[2] = z = 30 // x ==> [10.2.30]    y == [\z\] == [4.20.6]  z == 30
            console.log('x',x,'y',y,'z',z); // [10.2.30] [4.20.6] 30

            
     </script>
</body>
</html>